package com.googlecode.yoohoo.xmppcore.protocol.parsing;

import com.googlecode.yoohoo.xmppcore.protocol.parsing.error.ErrorParserFactory;
import com.googlecode.yoohoo.xmppcore.protocol.parsing.error.StanzaErrorDetailsParserFactory;
import com.googlecode.yoohoo.xmppcore.protocol.parsing.error.StreamErrorDetailsParserFactory;
import com.googlecode.yoohoo.xmppcore.protocol.parsing.error.XmppErrorType;
import com.googlecode.yoohoo.xmppcore.protocol.stanza.Iq;
import com.googlecode.yoohoo.xmppcore.protocol.stanza.Message;
import com.googlecode.yoohoo.xmppcore.protocol.stanza.Presence;
import com.googlecode.yoohoo.xmppcore.protocol.stanza.error.StanzaError;
import com.googlecode.yoohoo.xmppcore.protocol.stream.error.StreamError;

public class PredefinedXmppParsingFactory extends XmppParsingFactory {
	public PredefinedXmppParsingFactory() {
		super();
		registerPredefinedParserFactories();
	}
	
	protected void registerPredefinedParserFactories() {
		registerParser(new MessageParserFactory(), new ProtocolRelation(null, Message.PROTOCOL_KEY));
		registerParser(new PresenceParserFactory(), new ProtocolRelation(null, Presence.PROTOCOL_KEY));
		registerParser(new IqParserFactory(), new ProtocolRelation(null, Iq.PROTOCOL_KEY));
		registerParser(new ErrorParserFactory(XmppErrorType.STANZA), new ProtocolRelation(null, StanzaError.PROTOCOL_KEY));
		registerParser(new ErrorParserFactory(XmppErrorType.STREAM), new ProtocolRelation(null, StreamError.PROTOCOL_KEY));
		registerParser(new StanzaErrorDetailsParserFactory(), new ProtocolRelation(StanzaError.PROTOCOL_KEY,
				StanzaError.PROTOCOL_KEY_ERROR_DETAIL));
		registerParser(new StreamErrorDetailsParserFactory(), new ProtocolRelation(StreamError.PROTOCOL_KEY,
				StreamError.PROTOCOL_KEY_ERROR_DETAIL));
	}
}
